﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Day06
{
    /// <summary>
    /// 定义结构体
    /// </summary>
    struct Direction
    {
        private int x;
        public int X
        {
            get { return x; }
            set { x = value; }
        }
        public int Y { get; set; }
        //结构体中一定送无参数构造函数，所以不能再包含无参数构造函数
        //public  Direction ()
        //{
        //}
        public Direction(int x, int y)
        {
            this.x = x;
            this.Y = y;
        }
        //每次调用都会生成新的Direction对象，不用就成为垃圾
        public static Direction Right
        {
            get { return new Direction(0, 1); }
        }
        public static Direction Left
        {
            get { return new Direction(0, -1); }
        }
        public static Direction Up
        {
            get { return new Direction(-1,0); }
        }
        public static Direction Down
        {
            get { return new Direction(1, 0); }
        }
    }
}
